package com.example.javapracticaltraining.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 
 * @TableName visitors
 */
@TableName(value ="visitors")
@Data
public class Visitors {
    /**
     * 
     */
    @TableId(value = "visitor_id", type = IdType.AUTO)
    private Integer visitorId;

    /**
     * 
     */
    @TableField(value = "visitor_name")
    private String visitorName;

    /**
     * 
     */
    @TableField(value = "id_card_number")
    private String idCardNumber;

    /**
     * 
     */
    @TableField(value = "visit_time")
    private LocalDateTime visitTime;

    /**
     * 
     */
    @TableField(value = "reason")
    private String reason;

    /**
     * 
     */
    @TableField(value = "visited_user_id")
    private Integer visitedUserId;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Visitors other = (Visitors) that;
        return (this.getVisitorId() == null ? other.getVisitorId() == null : this.getVisitorId().equals(other.getVisitorId()))
            && (this.getVisitorName() == null ? other.getVisitorName() == null : this.getVisitorName().equals(other.getVisitorName()))
            && (this.getIdCardNumber() == null ? other.getIdCardNumber() == null : this.getIdCardNumber().equals(other.getIdCardNumber()))
            && (this.getVisitTime() == null ? other.getVisitTime() == null : this.getVisitTime().equals(other.getVisitTime()))
            && (this.getReason() == null ? other.getReason() == null : this.getReason().equals(other.getReason()))
            && (this.getVisitedUserId() == null ? other.getVisitedUserId() == null : this.getVisitedUserId().equals(other.getVisitedUserId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getVisitorId() == null) ? 0 : getVisitorId().hashCode());
        result = prime * result + ((getVisitorName() == null) ? 0 : getVisitorName().hashCode());
        result = prime * result + ((getIdCardNumber() == null) ? 0 : getIdCardNumber().hashCode());
        result = prime * result + ((getVisitTime() == null) ? 0 : getVisitTime().hashCode());
        result = prime * result + ((getReason() == null) ? 0 : getReason().hashCode());
        result = prime * result + ((getVisitedUserId() == null) ? 0 : getVisitedUserId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", visitorId=").append(visitorId);
        sb.append(", visitorName=").append(visitorName);
        sb.append(", idCardNumber=").append(idCardNumber);
        sb.append(", visitTime=").append(visitTime);
        sb.append(", reason=").append(reason);
        sb.append(", visitedUserId=").append(visitedUserId);
        sb.append("]");
        return sb.toString();
    }
}


